<!-- 反馈管理 -->
 <template>
  <div class="feedback">
    <h3>反馈管理</h3>

    <!-- 筛选查询 -->
    <el-form :inline="true" class="demo-form-inline">
      <el-form-item label="反馈内容">
        <el-input v-model="content" placeholder="请输入反馈内容"></el-input>
      </el-form-item>
      <el-form-item label="反馈时间">
        <el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
      </el-form-item>
      <el-form-item label="处理状态">
        <el-select v-model="status" placeholder="请选择处理状态">
          <el-option label="全部" value=""></el-option>
          <el-option label="未处理" value="unprocessed"></el-option>
          <el-option label="已处理" value="processed"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>

    <!-- 反馈列表 -->
    <el-table :data="tableData" style="width: 100%; margin-top: 20px;">
      <el-table-column prop="content" label="反馈内容" show-overflow-tooltip></el-table-column>
      <el-table-column prop="createTime" label="反馈时间" width="180"></el-table-column>
      <el-table-column prop="status" label="处理状态" width="100">
        <template #default="scope">
          <el-tag :type="scope.row.status === 'processed' ? 'success' : 'info'">{{ scope.row.status }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="200">
        <template #default="scope">
          <el-button @click="handleFeedback(scope.row)" type="text" size="small">处理</el-button>
          <el-button @click="viewDetails(scope.row)" type="text" size="small">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <el-pagination layout="prev, pager, next" :total="100" style="margin-top: 20px;"></el-pagination>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';

const content = ref('');
const dateRange = ref([]);
const status = ref('');
const tableData = ref([
  {
    id: 1,
    content: '这是第一条反馈。',
    createTime: '2023-10-01 10:00:00',
    status: 'unprocessed'
  },
  // 其他反馈数据...
]);

const onSubmit = () => {
  console.log('查询条件:', content.value, dateRange.value, status.value);
};

const handleFeedback = (row) => {
  row.status = 'processed';
  ElMessage.success('反馈已处理');
};

const viewDetails = (row) => {
  console.log('查看反馈详情:', row);
};
</script>

<style scoped>
.feedback {
  padding: 20px;
}
</style>